import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router);

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
}

export default new Router({
    mode: 'history',
    // base: '/',
    // routes: [
    //     {
    //         path: '/',
    //         name: 'main',
    //         component: () => import("@/views/main"),
    //         children: [
    //             {
    //                 path: '/admin/user/user/list',
    //                 name: '用户管理',
    //                 component: () => import("@/views/user/user/list"),
    //             },
    //             {
    //                 path: '/admin/user/label/list',
    //                 name: '标签管理',
    //                 component: () => import("@/views/user/label/list"),
    //             },
    //             {
    //                 path: '*',//匹配未定义的路由
    //                 name:'notFound',
    //                 component: () => import('@/views/notFound')
    //             }
    //         ]
    //     },
    //     {
    //         path: '/login',
    //         name: 'login',
    //         component: () => import("@/views/login"),
    //     }
    // ]
    routes: [
        {
            path: '/',
            name: 'main',
            component: () => import("@/views/main"),
            children: [
                // {
                //     path: '/views/user/user/list',
                //     name: '用户管理',
                //     component: () => import("@/views/user/user/list"),
                //     children:[
                //     ]
                // },
                // {
                //     path: '/views/user/label/list',
                //     name: '标签管理',
                //     component: () => import("@/views/user/label/list"),
                // },
                // {
                //     path: '*',//匹配未定义的路由
                //     name:'notFound',
                //     component: () => import('@/views/notFound')
                // }
            ]
        },
        {
            path: '/login',
            name: 'login',
            component: () => import("@/views/login"),
        }
    ]
})